]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Replace custom override schema with per-desktop override
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 16 Aug 2017 19:15:48 +0000 (21:15 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 31 Jul 2018 18:36:26 +0000 (18:36 +0000)
GSettings now recognizes per-desktop overrides that can be used
to change schemas' default values for a particular desktop. This
is not entirely unlike our existing custom override mechanism in
mutter, except that it is not limited to keys in org.gnome.mutter,
and it doesn't require a separate schema - the latter means that
we (and gnome-teak-tool) no longer have to figure out the correct
schema for the current login session and just use the original one.

https://bugzilla.gnome.org/show_bug.cgi?id=786496

data/00_org.gnome.shell.gschema.override [new file with mode: 0644]
data/meson.build
data/org.gnome.shell.gschema.xml.in
js/ui/windowManager.js
src/main.c
src/shell-global.c
src/shell-global.h

diff --git a/data/00_org.gnome.shell.gschema.override b/data/00_org.gnome.shell.gschema.override
new file mode 100644 (file)
index 0000000..ac732e6
--- /dev/null
@@ -0,0 +1,6 @@
+[org.gnome.mutter:GNOME]
+attach-modal-dialogs=true
+edge-tiling=true
+dynamic-workspaces=true
+workspaces-only-on-primary=true
+focus-change-on-pointer-rest=true
index 1c2b952a271e35b985fe6453d3d8e5293cb1ddc2..de2e2053cbd227dc2e133c26df8a992705d3b554 100644 (file)
@@ -92,6 +92,7 @@ schema = configure_file(
   configuration: schemaconf,
   install_dir: schemadir
 )
+install_data('00_org.gnome.shell.gschema.override', install_dir: schemadir)
 
 if have_systemd
   unitconf = configuration_data()
index 63a19032da01562621e5b20af747ee08c9f16611..4ec01a427f06fe04189ef7536c4bbf38275add5d 100644 (file)
     </key>
   </schema>
 
+  <!-- unused, change 00_org.gnome.shell.gschema.override instead --!>
   <schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/"
          gettext-domain="@GETTEXT_PACKAGE@">
     <key name="attach-modal-dialogs" type="b">
index d2d441d0c85449b3d20cf0b94e2cd05b68fa5745..79c9797d27aa5a6c28c5b122f015b2b08930f47f 100644 (file)
@@ -215,20 +215,12 @@ var WorkspaceTracker = new Lang.Class({
         global.display.connect('restacked',
                                this._windowsRestacked.bind(this));
 
-        this._workspaceSettings = this._getWorkspaceSettings();
+        this._workspaceSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' });
         this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this));
 
         this._nWorkspacesChanged();
     },
 
-    _getWorkspaceSettings() {
-        let settings = global.get_overrides_settings();
-        if (settings &&
-            settings.settings_schema.list_keys().indexOf('dynamic-workspaces') > -1)
-            return settings;
-        return new Gio.Settings({ schema_id: 'org.gnome.mutter' });
-    },
-
     blockUpdates() {
         this._pauseWorkspaceCheck = true;
     },
index 857877b0b111c7ac9c33d27b2744090c4c021424..01155777cf6723040f515e75eb166d11f45cced6 100644 (file)
@@ -31,8 +31,6 @@ extern GType gnome_shell_plugin_get_type (void);
 #define SHELL_DBUS_SERVICE "org.gnome.Shell"
 #define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
 
-#define OVERRIDES_SCHEMA "org.gnome.shell.overrides"
-
 #define WM_NAME "GNOME Shell"
 #define GNOME_WM_KEYBINDINGS "Mutter,GNOME Shell"
 
@@ -172,26 +170,6 @@ shell_dbus_init (gboolean replace)
   g_object_unref (session);
 }
 
-static void
-shell_prefs_init (void)
-{
-  ShellGlobal *global = shell_global_get ();
-  GSettings *settings = shell_global_get_overrides_settings (global);
-  GSettingsSchema *schema;
-  char **keys, **k;
-
-  if (!settings)
-    return;
-
-  g_object_get (G_OBJECT (settings), "settings-schema", &schema, NULL);
-
-  for (keys = k = g_settings_schema_list_keys (schema); *k; k++)
-    meta_prefs_override_preference_schema (*k, g_settings_schema_get_id (schema));
-
-  g_strfreev (keys);
-  g_settings_schema_unref (schema);
-}
-
 static void
 shell_introspection_init (void)
 {
@@ -509,8 +487,6 @@ main (int argc, char **argv)
 
   _shell_global_init ("session-mode", session_mode, NULL);
 
-  shell_prefs_init ();
-
   dump_gjs_stack_on_signal (SIGABRT);
   dump_gjs_stack_on_signal (SIGFPE);
   dump_gjs_stack_on_signal (SIGIOT);
index 52b1f72a41a2386e241547518942c28d4f2d7c59..dbd3bbe9518f24ba86feeac8aab0279f942bf1b5 100644 (file)
@@ -1338,37 +1338,6 @@ shell_global_get_settings (ShellGlobal *global)
   return global->settings;
 }
 
-/**
- * shell_global_get_overrides_settings:
- * @global: A #ShellGlobal
- *
- * Get the session overrides GSettings instance.
- *
- * Return value: (transfer none): The GSettings object
- */
-GSettings *
-shell_global_get_overrides_settings (ShellGlobal *global)
-{
-  static GSettings *settings = NULL;
-  const char *schema;
-
-  g_return_val_if_fail (SHELL_IS_GLOBAL (global), NULL);
-
-  if (!settings)
-    {
-      if (strcmp (global->session_mode, "classic") == 0)
-        schema = "org.gnome.shell.extensions.classic-overrides";
-      else if (strcmp (global->session_mode, "user") == 0)
-        schema = "org.gnome.shell.overrides";
-      else
-        return NULL;
-
-      settings = g_settings_new (schema);
-    }
-
-  return settings;
-}
-
 /**
  * shell_global_get_current_time:
  * @global: A #ShellGlobal
index ce03fb51fd5e7bff670c90a0aa92e14a8731814e..c8cddf8835c7ef150601ba365926ddbba3f8f91d 100644 (file)
@@ -19,7 +19,6 @@ ClutterStage  *shell_global_get_stage                 (ShellGlobal *global);
 MetaDisplay   *shell_global_get_display               (ShellGlobal *global);
 GList         *shell_global_get_window_actors         (ShellGlobal *global);
 GSettings     *shell_global_get_settings              (ShellGlobal *global);
-GSettings     *shell_global_get_overrides_settings    (ShellGlobal *global);
 guint32        shell_global_get_current_time          (ShellGlobal *global);